// E2E测试配置文件
export const testConfig = {
  // 登录账号配置
  auth: {
    username: 'tuo',
    password: 'tuo123456',
  },
  
  // 注册账号配置
  register: {
    username: 'testuser',
    email: 'test@example.com',
    password: 'password123',
    fullName: '测试用户',
    familyName: '测试家庭',
  },
  
  // 测试超时配置
  timeouts: {
    navigation: 10000,
    action: 5000,
    modal: 3000,
  },
  
  // 选择器配置
  selectors: {
    // 登录相关选择器 (Element UI Dialog)
    loginModal: '.el-dialog:has(.el-dialog__title:has-text("登录"))',
    loginForm: '.el-form',
    usernameInput: 'input[placeholder*="用户名"]',
    passwordInput: 'input[type="password"]',
    submitButton: '.el-button:has-text("登录")',
    userStatus: '.user-status',
    loginBtn: '.user-status__login-btn',
    registerTab: '.el-button:has-text("注册账号")',
    activeTab: '.el-button',
    registerButton: '.el-button:has-text("注册")',
    registerForm: '.el-form',
    registerUsername: 'input[placeholder*="用户名"]',
    registerEmail: 'input[placeholder*="邮箱"]',
    registerFullname: 'input[placeholder*="姓名"]',
    registerFamily: 'input[placeholder*="家庭"]',
    registerPassword: 'input[type="password"]',
    registerConfirmPassword: 'input[placeholder*="确认密码"]',
    userInfo: '.user-status__user-info',
    appWindow: '.app-window',
    desktopIcon: '.desktop-icon',
    addButton: '.add-button',
    closeButton: '.close-button',
    windowControl: '.window-control',
    minimizeButton: '.window-control.minimize',
    maximizeButton: '.window-control.maximize',
    closeWindowButton: '.window-control.close',
    
    // 日程管理选择器 (Element UI Dialog)
    scheduleManagement: '.el-dialog:has(.el-dialog__title:has-text("日程管理"))',
    scheduleCalendar: '.schedule-calendar',
    calendarCell: '.calendar-cell',
    calendarDayNumber: '.calendar-day-number',
    scheduleItem: '.schedule-item',
    scheduleTime: '.schedule-time',
    scheduleTitle: '.schedule-title',
    calendarHeader: '.calendar-header',
    calendarNav: '.calendar-nav',
    todayButton: '.el-button:has-text("今天")',
    viewToggle: '.calendar-view-toggle',
    monthView: '.el-radio-button__inner:has-text("月视图")',
    weekView: '.el-radio-button__inner:has-text("周视图")',
    addScheduleModal: '.el-dialog:has(.el-dialog__title:has-text("新建日程"))',
    scheduleForm: '.el-form',
    titleInput: 'input[placeholder*="日程标题"]',
    startTimePicker: 'input[placeholder*="选择开始时间"]',
    endTimePicker: 'input[placeholder*="选择结束时间"]',
    statusSelect: '.el-select',
    prioritySelect: '.el-select',
    memberSelect: '.el-select',
    locationInput: 'input[placeholder*="位置信息"]',
    descriptionTextarea: 'textarea[placeholder*="日程描述"]',
    submitScheduleBtn: '.el-button:has-text("创建")',
    cancelBtn: '.el-button:has-text("取消")',
    scheduleDetailModal: '.el-dialog:has(.el-dialog__title:has-text("日程详情"))',
    editScheduleBtn: '.el-button:has-text("编辑")',
    deleteScheduleBtn: '.el-button:has-text("删除")',
    confirmDeleteBtn: '.el-button:has-text("确认删除")',
  },
  
  // 应用配置
  app: {
    baseUrl: 'http://localhost:5173',
    viewport: {
      width: 1280,
      height: 720,
    },
    mobileViewport: {
      width: 375,
      height: 667,
    },
  },
};

// 环境变量覆盖
const envUsername = process.env.TEST_USERNAME;
const envPassword = process.env.TEST_PASSWORD;

if (envUsername && envPassword) {
  testConfig.auth.username = envUsername;
  testConfig.auth.password = envPassword;
}

export default testConfig;